# -*- coding: utf-8 -*-
# __author__ = 'xxx'
# env:
# fuction: socket  tcp  server

import socket
import time

HOST = ''                 # Symbolic name meaning all available interfaces
PORT = 8080              # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
print 'Connected by', addr
while 1:
    data = conn.recv(9600)
    if not data:
        continue

    print(time.gmtime())
    print("-----------------------------")
    print(data)


conn.close()
